package com.pospi.util;

import android.content.Context;

import com.lany.sp.SPHelper;
import com.pospi.dao.OrderDao;
import com.pospi.dto.OrderDto;
import com.pospi.http.MaxNO;
import com.pospi.pai.yunpos.login.Constant;
import com.pospi.pai.yunpos.more.RestOrderActivity;
import com.pospi.util.constant.URL;

/**
 * Created by acer on 2018/11/13.
 */

public class OderUtil {
    //挂单
    public static void saveOrder(Context context,String orderDetail, String ys, String vipinfo, String orderno, String vipno) {
        String shopId = SPHelper.getInstance().getString(Constant.STORE_ID);
        OrderDto orderDto = new OrderDto();
        orderDto.setOrder_info(orderDetail);//存储的该订单的商品的信息
        orderDto.setPayway(null);
        orderDto.setTime(GetData.getYYMMDDTime());
        orderDto.setSs_money("0.00");
        orderDto.setYs_money(ys);
        orderDto.setZl_money("0.00");
        orderDto.setShop_id(shopId);
        orderDto.setTableNumber("");
        orderDto.setTableId(vipinfo);
        orderDto.setOrderType(URL.ORDERTYPE_SALE);
        orderDto.setMaxNo(orderno);
        orderDto.setVipNumber(vipno);
        orderDto.setCheckoutTime(GetData.getDataTime());
        orderDto.setDetailTime(GetData.getHHmmssTimet());
        orderDto.setHasReturnGoods(URL.hasReturnGoods_No);
        orderDto.setOut_trade_no(null);
        //当挂单的时候该数据用于保存是哪个界面进行的挂单操作
        orderDto.setPayReturn(RestOrderActivity.REST_Point);
        orderDto.setIfFinishOrder(URL.ZHUOTai);
        //给数据库里面添加一条记录
        new OrderDao(context).addOrder(orderDto);
    }
}
